# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponse do
  @moduledoc """
  Response message for DocumentService.SearchDocuments.

  ## Attributes

  *   `histogramQueryResults` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryResult.t)`, *default:* `nil`) - The histogram results that match with the specified SearchDocumentsRequest.histogram_queries.
  *   `matchingDocuments` (*type:* `list(GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument.t)`, *default:* `nil`) - The document entities that match the specified SearchDocumentsRequest.
  *   `metadata` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1ResponseMetadata.t`, *default:* `nil`) - Additional information for the API invocation, such as the request tracking id.
  *   `nextPageToken` (*type:* `String.t`, *default:* `nil`) - The token that specifies the starting position of the next page of results. This field is empty if there are no more results.
  *   `questionAnswer` (*type:* `String.t`, *default:* `nil`) - Experimental. Question answer from the query against the document.
  *   `totalSize` (*type:* `integer()`, *default:* `nil`) - The total number of matched documents which is available only if the client set SearchDocumentsRequest.require_total_size to `true` or set SearchDocumentsRequest.total_result_size to `ESTIMATED_SIZE` or `ACTUAL_SIZE`. Otherwise, the value will be `-1`. Typically a UI would handle this condition by displaying "of many", for example: "Displaying 10 of many".
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :histogramQueryResults =>
            list(
              GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryResult.t()
            )
            | nil,
          :matchingDocuments =>
            list(
              GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument.t()
            )
            | nil,
          :metadata =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1ResponseMetadata.t()
            | nil,
          :nextPageToken => String.t() | nil,
          :questionAnswer => String.t() | nil,
          :totalSize => integer() | nil
        }

  field(:histogramQueryResults,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1HistogramQueryResult,
    type: :list
  )

  field(:matchingDocuments,
    as:
      GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponseMatchingDocument,
    type: :list
  )

  field(:metadata,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1ResponseMetadata
  )

  field(:nextPageToken)
  field(:questionAnswer)
  field(:totalSize)
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponse do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponse.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SearchDocumentsResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
